package com.googlecode.awsbootstrap;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.S3Object;
import com.googlecode.totallylazy.Streams;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) throws IOException {
        final String s3Bucket = args[0];
        final String s3Key = args[1];
        AmazonS3 s3 = new AmazonS3Client();
        final S3Object object = s3.getObject(s3Bucket, s3Key);
        final InputStream objectContent = new BufferedInputStream(object.getObjectContent());
        Streams.copy(objectContent,System.out);
        System.out.flush();
    }
}
